package com.byinsight.web.actions.dimension;

import java.util.ArrayList;
import java.util.List;

import com.byinsight.web.actions.CheckSessionAction;

import eg.backend.domain.Dimension;

//list available dimensions that the user can see in DimensionManager
public class ListAvailableDimensions extends CheckSessionAction {
	private static final long serialVersionUID = 817053219125273845L;
	
	private String targetUser;
	private String group;
	
	@Override
	protected String process() {
		List<Dimension> result = new ArrayList<Dimension>();
		List<Dimension> systemDimensions = dimensionManager.getSystemDimensions();
		result.addAll(systemDimensions);
		List<Dimension> userDimensions = dimensionManager.getUserDimensions();
		result.addAll(userDimensions);
		if(targetUser != null) {
			//list targetUser's dimensions that current user can see
//			result.addAll(dimensionManager.getAvailableDimensions(targetUser));
		} else if(!group.isEmpty()) {
			//list this group's dimensions that current user can see
		} else {
			//list all dimensions that current user can see
//			result.addAll(dimensionManager.getOthersDimensions());
		}
		return "";//DimensionHelper.toXml(result).toString();
	}

	/* common */
	public String getTargetUser() {
		return targetUser;
	}

	public void setTargetUser(String targetUser) {
		this.targetUser = targetUser;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}
}
